/**
 * This is my code.
 *
 * $Id$
 */
package fi.jab.esb.config.xml.impl;

import fi.jab.esb.config.xml.PropertyType;
import fi.jab.esb.config.xml.Schedule;
import fi.jab.esb.config.xml.XmlPackage;

import java.util.Collection;

import javax.xml.datatype.XMLGregorianCalendar;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Schedule</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fi.jab.esb.config.xml.impl.ScheduleImpl#getProperty <em>Property</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.ScheduleImpl#getEndDate <em>End Date</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.ScheduleImpl#getScheduleid <em>Scheduleid</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.ScheduleImpl#getStartDate <em>Start Date</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public abstract class ScheduleImpl extends EObjectImpl implements Schedule
{
  /**
   * The cached value of the '{@link #getProperty() <em>Property</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getProperty()
   * @generated
   * @ordered
   */
  protected EList<PropertyType> property;

  /**
   * The default value of the '{@link #getEndDate() <em>End Date</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEndDate()
   * @generated
   * @ordered
   */
  protected static final XMLGregorianCalendar END_DATE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getEndDate() <em>End Date</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEndDate()
   * @generated
   * @ordered
   */
  protected XMLGregorianCalendar endDate = END_DATE_EDEFAULT;

  /**
   * The default value of the '{@link #getScheduleid() <em>Scheduleid</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getScheduleid()
   * @generated
   * @ordered
   */
  protected static final String SCHEDULEID_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getScheduleid() <em>Scheduleid</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getScheduleid()
   * @generated
   * @ordered
   */
  protected String scheduleid = SCHEDULEID_EDEFAULT;

  /**
   * The default value of the '{@link #getStartDate() <em>Start Date</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getStartDate()
   * @generated
   * @ordered
   */
  protected static final XMLGregorianCalendar START_DATE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getStartDate() <em>Start Date</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getStartDate()
   * @generated
   * @ordered
   */
  protected XMLGregorianCalendar startDate = START_DATE_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ScheduleImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return XmlPackage.Literals.SCHEDULE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<PropertyType> getProperty()
  {
    if (property == null)
    {
      property = new EObjectContainmentEList<PropertyType>(PropertyType.class, this, XmlPackage.SCHEDULE__PROPERTY);
    }
    return property;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public XMLGregorianCalendar getEndDate()
  {
    return endDate;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setEndDate(XMLGregorianCalendar newEndDate)
  {
    XMLGregorianCalendar oldEndDate = endDate;
    endDate = newEndDate;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.SCHEDULE__END_DATE, oldEndDate, endDate));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getScheduleid()
  {
    return scheduleid;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setScheduleid(String newScheduleid)
  {
    String oldScheduleid = scheduleid;
    scheduleid = newScheduleid;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.SCHEDULE__SCHEDULEID, oldScheduleid, scheduleid));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public XMLGregorianCalendar getStartDate()
  {
    return startDate;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setStartDate(XMLGregorianCalendar newStartDate)
  {
    XMLGregorianCalendar oldStartDate = startDate;
    startDate = newStartDate;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.SCHEDULE__START_DATE, oldStartDate, startDate));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE__PROPERTY:
        return ((InternalEList<?>)getProperty()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE__PROPERTY:
        return getProperty();
      case XmlPackage.SCHEDULE__END_DATE:
        return getEndDate();
      case XmlPackage.SCHEDULE__SCHEDULEID:
        return getScheduleid();
      case XmlPackage.SCHEDULE__START_DATE:
        return getStartDate();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE__PROPERTY:
        getProperty().clear();
        getProperty().addAll((Collection<? extends PropertyType>)newValue);
        return;
      case XmlPackage.SCHEDULE__END_DATE:
        setEndDate((XMLGregorianCalendar)newValue);
        return;
      case XmlPackage.SCHEDULE__SCHEDULEID:
        setScheduleid((String)newValue);
        return;
      case XmlPackage.SCHEDULE__START_DATE:
        setStartDate((XMLGregorianCalendar)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE__PROPERTY:
        getProperty().clear();
        return;
      case XmlPackage.SCHEDULE__END_DATE:
        setEndDate(END_DATE_EDEFAULT);
        return;
      case XmlPackage.SCHEDULE__SCHEDULEID:
        setScheduleid(SCHEDULEID_EDEFAULT);
        return;
      case XmlPackage.SCHEDULE__START_DATE:
        setStartDate(START_DATE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE__PROPERTY:
        return property != null && !property.isEmpty();
      case XmlPackage.SCHEDULE__END_DATE:
        return END_DATE_EDEFAULT == null ? endDate != null : !END_DATE_EDEFAULT.equals(endDate);
      case XmlPackage.SCHEDULE__SCHEDULEID:
        return SCHEDULEID_EDEFAULT == null ? scheduleid != null : !SCHEDULEID_EDEFAULT.equals(scheduleid);
      case XmlPackage.SCHEDULE__START_DATE:
        return START_DATE_EDEFAULT == null ? startDate != null : !START_DATE_EDEFAULT.equals(startDate);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (endDate: ");
    result.append(endDate);
    result.append(", scheduleid: ");
    result.append(scheduleid);
    result.append(", startDate: ");
    result.append(startDate);
    result.append(')');
    return result.toString();
  }

} //ScheduleImpl
